<title>banner图</title>
<div class="layui-fluid">

    <script type="text/html" id="toolbar">
        <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm save" data-title="添加banner图" data-url="/banner/image_save"> 添加banner图 </button>
        </div>
    </script>

    <table class="layui-hide" id="banner-image-list" lay-filter="banner-image-list"></table>

    <script type="text/html" id="banner_image_bar">
        <a class="layui-btn layui-btn-xs save" data-title="编辑banner图" data-url="/banner/image_save" data-id='{{ d.id }}'>编辑</a>
        <a class="layui-btn layui-btn-xs layui-btn-danger delete" data-url="admin/banner/delete_image/id/{{ d.id }}">删除</a>
    </script>

</div>
<script>
    layui.use(['form', 'table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;

        var tableIns = table.render({
            elem: '#banner-image-list',
            url: layui.setter.API_HOST + '/admin/banner/images',
            toolbar: '#toolbar',
            cols: [[
                {field: 'id', width: 80, title: 'ID', sort: true},
                {field: '', width: 180, title: 'banner位', templet: function(res) {
					if(res.seat) {
						return res.seat.title;
					}
					return '';
				}},
                {field: '', width: 150, title: '图片', templet: function(res) {
					if(res.image) {
						return '<img src="'+ res.min_image +'" style="max-width: 100px; max-height: 100px;" />';
					}
					return '';
				}},
                {title: '操作', templet: '#banner_image_bar'}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true
        });
    });
</script>